package com.qfjy.homework.yangxiao;

/**
 * @author 既然青春留不住
 */
public class ShapeFactory {

 /**
  * 使用 getShape 方法获取形状类型的对象
  */
 public Shape getShape(String shapeType) {
  if (shapeType == null) {
   return null;
  }
  if (shapeType.equals("圆形")) {
   return new Circle();
  }
  if (shapeType.equals("正方形")) {
   return new Square();
  }
  if (shapeType.equals("矩形")) {
   return new Rectangle();
  }
  return null;
 }
}
